<?php


namespace Xiaoguai\DesignPattern\DP007;


class RedisCacheCloneable
{
    public function __clone()
    {
        $reflect_object = new \ReflectionObject($this);
        $properties = $reflect_object->getProperties();

        foreach ($properties as $property) {
            if (gettype($property->getValue()) == 'object') {
                $this->{$property->name} = $property->getValue();
            }
        }
    }
}